package pers.zyl.juc;

import java.util.concurrent.atomic.AtomicInteger;

public class Cas {
    private static AtomicInteger integer = new AtomicInteger(1);
    public static void main(String[] args) {
        int i1 = 3;
        Thread[] t = new Thread[i1];
        for (int i = 0; i < i1; i++) {
            t[i] = new Thread(() -> {
                integer.getAndIncrement();
            });
            t[i].start();
        }
        for (int i = 0; i < 3; i++) {
            try {
                t[i].join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println(integer.get());
    }
}
